<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>Insert title here</title>
		<script type="text/javascript" src="../jquery/jquery-1.6.1.js"></script>
	</head>
<body>
	XML
	<hr color="red">
	id:<select name="id" id="id"></select>
	name:<select name="name" id="name"></select>
	<script type="text/javascript">
	$(function(){
		$.post(
			"/test/Ajax03",
			function(data){
				var user = $(data).find("user");
				var id = new Array();
				var name = new Array();
				$("#id").empty();
				$("#name").empty();
				for(var i=0;i<user.size();i++){
					id[i] = user.eq(i).attr("id");
					name[i] = user.eq(i).find("name").text();
					var idoption="<option value="+id[i]+">"+id[i]+"</option>";
					var nameoption="<option value="+name[i]+">"+name[i]+"</option>";
					$("#id").append(idoption);
					$("#name").append(nameoption);
				}
			}		
		);
	});
	</script>
</body>
</html>